package com.zf.shuashua;

import android.text.TextUtils;

import com.zf.shuashua.advert.AdvertConstants;
import com.zf.shuashua.advert.ReportConstants;
import com.zf.shuashua.utils.ToastUtil;
import com.zf.shuashua.utils.Util;

public class AdvertUtils {

    public static String getReportType(String advertType, String reportId){
        if(!TextUtils.isEmpty(reportId)){
            return reportId;
        }
        return getReportType(advertType);
    }

    private static String getReportType(String advertType) {
        String type = ReportConstants.REWARD_TYPE_PUNCH;
        switch (advertType) {
            case AdvertConstants.REWARD_TYPE_PUNCH:
                type = ReportConstants.REWARD_TYPE_PUNCH;
                break;
            case AdvertConstants.REWARD_TYPE_TASK:
                type = ReportConstants.REWARD_TYPE_TASK;
                break;
            case AdvertConstants.REWARD_TYPE_AUTO:
                type = ReportConstants.REWARD_TYPE_AUTO;
                break;
            case AdvertConstants.REWARD_TYPE_SHARE:
                type = ReportConstants.REWARD_TYPE_SHARE;
                break;
            case AdvertConstants.REWARD_TYPE_FIRST:
                type = ReportConstants.REWARD_TYPE_FIRST;
                break;
            case AdvertConstants.REWARD_TYPE_LIKE:
                type = ReportConstants.REWARD_TYPE_LIKE;
                break;
            case AdvertConstants.REWARD_TYPE_BIND:
            case AdvertConstants.REWARD_TYPE_BIND_QQ:
            case AdvertConstants.REWARD_TYPE_BIND_WEIBO:
                type = ReportConstants.REWARD_TYPE_BIND;
                break;
            case AdvertConstants.REWARD_TYPE_NOTIFICATION:
                type = ReportConstants.REWARD_TYPE_NOTIFICATION;
                break;
            case AdvertConstants.REWARD_TYPE_TIME_LIMIT:
                type = ReportConstants.REWARD_TYPE_TIME_LIMIT;
                break;
            case AdvertConstants.REWARD_TYPE_APPRAISE:
                type = ReportConstants.REWARD_TYPE_APPRAISE;
                break;
            case AdvertConstants.REWARD_TYPE_BUBBLE:
                type = ReportConstants.REWARD_TYPE_BUBBLE;
                break;
            case AdvertConstants.REWARD_TYPE_DWJ:
                type = ReportConstants.REWARD_TYPE_DWJ;
                break;
            case AdvertConstants.REWARD_TYPE_POOL:
                type = ReportConstants.REWARD_TYPE_POOL;
                break;
            case AdvertConstants.REWARD_TYPE_TURNTABLE:
                type = ReportConstants.REWARD_TYPE_TURNTABLE;
                break;
            case AdvertConstants.REWARD_TYPE_QIXI:
                type = ReportConstants.REWARD_TYPE_QIXI;
                break;
            case AdvertConstants.REWARD_TYPE_GAME:
                type = ReportConstants.REWARD_TYPE_GAME;
                break;
            case AdvertConstants.REWARD_TYPE_NEW_WITHDRAW:
                type = ReportConstants.REWARD_TYPE_NEW_WITHDRAW;
                break;
        }
        return type;
    }

    /**
     * 穿山甲代码位
     * @param advertType
     * @return
     */
    public static String getByteCodeId(String advertType) {
        return getByteRewardId();
//        String codeId = "945109757";
//        switch (advertType) {
//            case AdvertConstants.REWARD_TYPE_PUNCH:
//                codeId = "945109757";
//                break;
//            case AdvertConstants.REWARD_TYPE_TASK:
//                codeId = "945109760";
//                break;
//            case AdvertConstants.REWARD_TYPE_APPRAISE:
//            case AdvertConstants.REWARD_TYPE_AUTO:
//                codeId = "945135400";
//                break;
//            case AdvertConstants.REWARD_TYPE_SHARE:
//                codeId = "945157660";
//                break;
//            case AdvertConstants.REWARD_TYPE_FIRST:
//                codeId = "945157668";
//                break;
//            case AdvertConstants.REWARD_TYPE_LIKE:
//                codeId = "945157676";
//                break;
//            case AdvertConstants.REWARD_TYPE_BIND:
//            case AdvertConstants.REWARD_TYPE_BIND_QQ:
//            case AdvertConstants.REWARD_TYPE_BIND_WEIBO:
//                codeId = "945157680";
//                break;
//            case AdvertConstants.REWARD_TYPE_NOTIFICATION:
//                codeId = "945157683";
//                break;
//            case AdvertConstants.REWARD_TYPE_GAME:
//            case AdvertConstants.REWARD_TYPE_TIME_LIMIT:
//                codeId = "945157685";
//                break;
//            case AdvertConstants.REWARD_TYPE_DWJ:
//            case AdvertConstants.REWARD_TYPE_POOL:
//            case AdvertConstants.REWARD_TYPE_TURNTABLE:
//            case AdvertConstants.REWARD_TYPE_QIXI:
//                codeId = "945157687";
//                break;
//            case AdvertConstants.REWARD_TYPE_BUBBLE:
//                codeId = "945434562";
//                break;
//        }
//        return codeId;
    }

    /**
     * 优量汇代码位
     * @param advertType
     * @return
     */
    public static String getTencentCodeId(String advertType) {
        String codeId = "7011947427907880";
        switch (advertType) {
            case AdvertConstants.REWARD_TYPE_PUNCH:
                codeId = "7011947427907880";
                break;
            case AdvertConstants.REWARD_TYPE_TASK:
                codeId = "6081046497123838";
                break;
            case AdvertConstants.REWARD_TYPE_APPRAISE:
            case AdvertConstants.REWARD_TYPE_AUTO:
                codeId = "1031544417235044";
                break;
            case AdvertConstants.REWARD_TYPE_SHARE:
                codeId = "1011349437738154";
                break;
            case AdvertConstants.REWARD_TYPE_FIRST:
                codeId = ":3001243487920739";
                break;
            case AdvertConstants.REWARD_TYPE_LIKE:
                codeId = "4091943427735090";
                break;
            case AdvertConstants.REWARD_TYPE_BIND:
            case AdvertConstants.REWARD_TYPE_BIND_QQ:
            case AdvertConstants.REWARD_TYPE_BIND_WEIBO:
                codeId = "4041149497434192";
                break;
            case AdvertConstants.REWARD_TYPE_NOTIFICATION:
                codeId = "5001141437922713";
                break;
            case AdvertConstants.REWARD_TYPE_NEW_WITHDRAW:
            case AdvertConstants.REWARD_TYPE_GAME:
            case AdvertConstants.REWARD_TYPE_TIME_LIMIT:
                codeId = "8071949427027934";
                break;
//            case AdvertConstants.REWARD_TYPE_POOL:
//            case AdvertConstants.REWARD_TYPE_DWJ:
//            case AdvertConstants.REWARD_TYPE_TURNTABLE:
//            case AdvertConstants.REWARD_TYPE_QIXI:
//                codeId = "2041946407939009";
//                break;
            case AdvertConstants.REWARD_TYPE_BUBBLE:
                codeId = "4021049437237230";
                break;
            default:
                codeId = "2041946407939009";
                break;
        }
        return codeId;
    }

    /**
     * 随机获取穿山甲开屏的代码位
     * @return
     */
    public static String getSplashId(){
        try{
            String [] s = {"887302592", "887351777", "887377605", "887367963"};
            int index = Util.getRandom(0, 3);
            return s[index];
        }catch (Exception ignored){

        }
        return "887351777";
    }

    /**
     * 随机获取优量汇开屏的代码位
     * @return
     */
    public static String getTencentSplashId(){
        try{
            String [] s = {"6001540417029504", "5081647407020516", "3091847417922519"};
            int index = Util.getRandom(0, 2);
            return s[index];
        }catch (Exception ignored){

        }
        return "5061128191977183";
    }

    /**
     * 随机获取穿山甲激励视频的代码位
     * @return
     */
    private static String getByteRewardId(){
        try{
            String [] s = {"945109757", "945157683", "945157668", "945109760", "945157685", "945157676", "945135400", "945157680", "945157660", "945353460", "945333342","945387406", "945164389", "945353459"};
            int index = Util.getRandom(0, 13);
            return s[index];
        }catch (Exception ignored){

        }
        return "945135400";
    }

    /**
     * 随机获取小米激励视频的代码位
     * @return
     */
    public static String getXiaomiId(){
        try{
            String [] s = {"32a15a52b44a2f3b8cc3ca1cac29e091", "1029f2134cd6d177b39ac057b7a91910"};
            int index = Util.getRandom(0, 1);
            return s[index];
        }catch (Exception ignored){

        }
        return "32a15a52b44a2f3b8cc3ca1cac29e091";
    }
}
